﻿using MyABP.EntityFramework;
using MyABP.Tasks;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace MyABP.Migrations.SeedData
{
    public class DefaultTestDataForTask
    {
        private readonly MyABPDbContext _context;

        private static readonly List<Task> _tasks;

        public DefaultTestDataForTask(MyABPDbContext context)
        {
            _context = context;
        }

        static DefaultTestDataForTask()
        {
            _tasks = new List<Task>()
            {
                new Task("Learning ABP deom", "Learning how to use abp framework to build a MPA application."),
                new Task("Make Lunch", "Cook 2 dishs"),
                new Task("看教学视频", "观看教学视频等等等等")
            };
        }

        public void Create()
        {
            foreach (var task in _tasks)
            {
                _context.Tasks.Add(task);
                _context.SaveChanges();
            }
        }

    }
}
